<?php

class Account_Form_PasswordReset extends Zend_Form
{
	public function init()
	{
		parent::init();

        // Set the method for the display form to POST
		$this
			->setAction('')
			->setMethod('post')
		;

		$stripSlashesFilter = new Euso_Filter_StripSlashes();

		// Create and configure identity element
		$identity = new Zend_Form_Element_Text('identity');
		$identityRegex = new Zend_Validate_Regex('/^[a-zA-Z0-9\_\-\.@]*$/');
		$identityRegex->setMessage(_('Please enter a valid username or email address'));
		$identity
			->setLabel('Username or email address:')
			->setRequired(true)
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->addFilter('StringToLower')
			->addValidator($identityRegex)
			->setAttrib('size', 36)
		;
		$this->addElement($identity);

        // Add the submit button
		$submit = new Zend_Form_Element_Submit('submit');
		$submit
			->setLabel('Send password reset key')
			->setIgnore(true)
			->setAttrib('class', 'submit')
		;
		$this->addElement($submit);
	}
}
